import {createStore} from 'vuex'
import shopState, { GoodsArrayProps } from "./modules/shop"
import course1State,{Course1ArrayProps} from './modules/course1';
import activityState, { activityArrayProps } from "./modules/activity"
import venuesState, { venuesArrayProps } from "./modules/venues"
import home from './modules/home'

// 定义 用户接口
export interface UserProps {
    name: string;
    age: number;
    sex: number;
}
  
// 定义 store根接口
export interface RootProps {
    isLogin: boolean;
    user: UserProps;
}

export interface AllProps extends RootProps {
    shopState: GoodsArrayProps;
    activityState: activityArrayProps;
    venuesState: venuesArrayProps;

    //  这个地方可以继续添加其他的 模块化 store
    course1State: Course1ArrayProps;
}

export default createStore<RootProps>({
    state: {
        isLogin: false,
        user: {
            name: "",
            age: 0,
            sex: 1,
        },
    },
    getters: {},
    mutations: {},
    actions: {},
    modules: {
        shopState: shopState,
        course1State:course1State,
        activityState: activityState,
        venuesState:venuesState,
        home: home
    }
})
